package com.google.code.msgbooster.batch.dispatcher.extension;

import weibo4j.Status;
import weibo4j.Weibo;

import com.google.code.msgbooster.batch.dispatcher.Core;
import com.google.code.msgbooster.batch.dispatcher.Message;
import com.google.code.msgbooster.model.extension.Consumer;

public final class Sina extends Core {

	@Override
	protected void send(Consumer consumer, Message message) throws Exception {
		System.setProperty("weibo4j.oauth.consumerKey", consumer.getConsumerKey());
		System.setProperty("weibo4j.oauth.consumerSecret", consumer.getConsumerSecret());
		Weibo weibo = new Weibo();
		weibo.setToken(consumer.getUser(), consumer.getPassword());
		Status status = weibo.updateStatus(message.getBody());
	}

	@Override
	protected boolean isRepost(Exception exception) {
		// TODO 需要判断是否再次发送。
		return false;
	}

}
